<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue_js取值问题</title>
    <script src="lib/vue.js"></script>
</head>

<body>
    <div id="app">
        <button @click='fromJs'>JS的值</button>
    </div>

    <script>
        var js = 1000;
        var gs;
        window.onload = function () {
            gs = 500;
            console.log("init");
            console.log(js);
            console.log(vm.msg);
            console.log(gs);
        }


        var vm = new Vue({
            el: "#app",
            data: {
                msg: "hello world"
            },
            methods: {
                fromJs() {
                    console.log(js);
                    console.log(gs);
                }
            }
        })
    </script>

</body>

</html>